<template>
	<view>
		<view class="" @click="togomai">
			点击使用金币白条
		</view>
		<view class="" @click="togomai">
			点击使用金币
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mch_id: 0,
				checked: [],
				goods: '',
				number: 1,
				store_id: 0
			}
		},
		methods: {
			togomai() {
				if (this.$store.state.user.accessToken === '' || this.$store.state.user.accessToken === null) {
					this.$store.dispatch('user/accessToken');
					return;
				}
				let attrs = [];
				this.checked.attr_list.forEach(item => {
					attrs.push({
						attr_id: item.attr_id,
						attr_group_id: item.attr_group_id
					});
				});
				let goods = {
					mch_id: this.goods.mch_id ? this.goods.mch_id : 0,
					goods_list: [{
						id: this.goods.id,
						attrs,
						num: this.number,
						cat_id: 0,
						goods_attr_id: this.checked.id
					}],
					// 添加从哪家店买的 8.23（别人（分享）的小店，精品店，）
					v_id: this.store_id,
					// 添加从哪个视频进来的（嗨我来了）
					video_id: this.video_id,
					// abbuy_type:this.abbuy_type
				}
				this.shop(goods);
			},
			shop: function(goods) {
				uni.navigateTo({
					url: `/pages/order-submit/order-submit?mch_list=${JSON.stringify([goods])}&store_id=${this.store_id}`
				});
			},
		}
	}
</script>

<style>

</style>
